
<%@page import="album.AlbumVo"%>
<%@page import="album.Album"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Album1_view.jsp</title>
<link rel="stylesheet" href="http://fonts.googleapis.com/earlyaccess/nanumgothic.css"/>
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<style>
.tile2{
	/* background-color:green; */
	position:absolute;
	height:510px;
	float:left;
	top:182px;
	left:1050px;
	font-size: 14px;
	font-family: 'Nanum Gothic', sans-serif;
}

#board_hr {
	margin-bottom: 20px;
	font-family: 'Lobster', cursive;
	font-size: 40px;
	color: #fb586c;
	font-weight: bold
}

#list_title,#list_item {
	line-height: 180%; /* 줄 간격 */
	display: table-cell;
	font-family: 'Nanum Gothic', sans-serif;
	
}

#list_title {
	width: 150px;
	background-color: #160952;
	color: white;
	font-family: 'Nanum Gothic', sans-serif;
	font-size: 14px;
}

#list_item {
	width: 450px;
	font-family: 'Nanum Gothic', sans-serif;
	font-size: 14px;
	color: black;
}

#list_line {
	width: 600px;
	height: 1px;
}

#list_item a:link, #list_item a:active, #list_item a:visited{
	color: black;
	text-decoration: none;
}

#list_content textarea{
	font-family: 'Nanum Gothic', sans-serif;
}

#list_content {
	width: 600px;
	height: 230px;
}

</style>
<script>
	var url = "Main.jsp?inc_content=Album1.jsp?inc_right=../album/";
	function getId(id){return document.getElementById(id);}
	function init(){
		getId("btnModify").onclick=function(){
			view_form.action = url + "Album1-Modify-result.jsp";
			view_form.submit();
		}
		getId("btnList").onclick=function(){
			location.href= url + "Album_list.jsp";
		}
	}
	
	function fileDownLoad(filename){
		// 파일 다운로드 스크립트
		// 새 창을 열어 첨부 파일을 무조건 다운로드 하도록
		url ="../album/Album1_FiledownLoad.jsp?filename=" + filename;
		win = window.open(url, "win", "");
		
	}
	function btnDelete(serial, filename){
		var f = confirm("정말 삭제하시겠습니까?");
		if(f){
			location.href = url + "Album1_delete.jsp&serial=" + serial + "&filename=" + filename;
		}else{
			alert("삭제가 취소되었습니다.");
		}
	}
	function fileDel(fileDelFlag, serial){
		var f = confirm("파일을 삭제 하시겠습니까?");
		if(f){
			location.href = url + 'Album1_view.jsp&fileDelFlag=' + fileDelFlag + '&serial=' + serial;
		}else{
			alert("파일삭제 취소되었습니다.");
		}
	}
</script>
</head>
<body>
<jsp:useBean id="albumVo" class="album.AlbumVo"/>
<jsp:setProperty property="*" name="albumVo"/>
<%
Album album = new Album();
album.setVo(albumVo);
System.out.println("serial : " + album.getVo().getSerial());
AlbumVo av = album.view();
%>
<div class="tile2">
	<h1 id='board_hr'>Album View</h1>
	<form action="" name="view_form" method="post" enctype="multipart/form-data">
		<div id="list_title">제목</div>
		<div id="list_item"><%=av.getSubject()%></div>
		<p/>
		<div id='list_line' style='background-color: #dddddd;'></div>
		
		<div id="list_title">아이디</div>
		<div id="list_item"><%=av.getMid()%></div>
		<p/>
		<div id='list_line' style='background-color: #dddddd;'></div>
		
		<div id='list_content'>
			<textarea name="content" style="width: 100%; height: 100%;"><%=av.getContent() %></textarea>
		</div>
		<div id='list_line' style='background-color: #dddddd;margin-top: 20px;'></div>
		
		<div id='list_title'>첨부파일</div>
		<div id='list_item'>
		<%if(av.getFilename() == null || albumVo.getFileDelFlag().equals("del")){ %>
			<input type="file" name="newfilename">
		<%}else{ %>
			<a href="#" onclick="fileDownLoad('<%=av.getFilename()%>')"><%=av.getFilename()%></a>
			<input type="button" value="파일삭제" onclick="fileDel('del', '<%=av.getSerial()%>')" style="font-family: 'Nanum Gothic', sans-serif; font-size: 14px; color:black";>
		<%} %>
		</div>
		<div id='list_line' style='background-color: #dddddd;'></div>
		<div id='list_line' style='background-color: #82B5DF;margin-bottom:10px'></div>
		
		<input type="hidden" name="serial" value="<%=av.getSerial()%>">
		<input type="hidden" name="filename" value="<%=av.getFilename() %>">
		<input type="hidden" name="fileDelFlag" value="<%=albumVo.getFileDelFlag()%>">
	</form>
	<input type="button" value="목록" id="btnList" style="font-family: 'Nanum Gothic', sans-serif; font-size: 14px; color:black";>
	<input type="button" value="수정" id="btnModify" style="font-family: 'Nanum Gothic', sans-serif; font-size: 14px; color:black";>
	<input type="button" value="삭제" onclick="btnDelete('<%=av.getSerial()%>', '<%=av.getFilename()%>')" style="font-family: 'Nanum Gothic', sans-serif; font-size: 14px; color:black";>
</div>
<script>init();</script>
</body>
</html>